import allure

from apis.product_api import ProductApi


class ProductCase(ProductApi):
    @allure.step("step：case_list")
    def case_list(self):
        """
        业务case：商品分类
        :return:
        """
        list_response = self.list_api()
        res = list_response.json()
        return res

    @allure.step("step:case_hot_product")
    def case_hot_product(self):
        """
        业务case：热门作品
        :return:
        """
        hot_product_response = self.hot_product_api()
        res = hot_product_response.json()
        return res

    @allure.step("step:case_home_page")
    def case_home_page(self):
        """
        业务case：首页banner
        :return:
        """
        home_page_response = self.home_page_api()
        res = home_page_response.json()
        return res

    @allure.step("step:case_creator")
    def case_creator(self):
        """
        业务case：首页创作者
        :return:
        """
        creator_response = self.creator_api()
        res = creator_response.json()
        return res

    @allure.step("step:case_hot_products")
    def case_hot_products(self):
        """业务case：首页热门作品集"""
        hot_products_response = self.hot_products_api()
        res = hot_products_response.json()
        return res

    @allure.step("step:case_guide")
    def case_guide(self):
        """
        业务case；首页向导
        :return:
        """
        guide_response = self.guide_api()
        res = guide_response.json()
        return res

    @allure.step("step:case_guide")
    def case_recommend_product(self):
        """
        业务case；首页推荐作品
        :return:
        """
        recommend_product_response = self.recommend_product_api()
        res = recommend_product_response.json()
        return res

    @allure.step("step:case_search")
    def case_search(self, data):
        """
        业务case：NFT搜索
        :return:
        """
        search_response = self.search_api(**data['json'])
        res = search_response.json()
        return res

    @allure.step("step:case_details")
    def case_details(self, data):
        """业务case：商品详情基础数据"""
        details_response = self.details_api(**data['json'])
        res = details_response.json()
        return res

    @allure.step("step:case_tradeTrace")
    def case_tradeTrace(self, data):
        """业务case：商品详情#交易溯源"""
        tradeTrace_response = self.tradeTrace_api(**data['json'])
        res = tradeTrace_response.json()
        return res

    @allure.step("step:case_priceTrend")
    def case_priceTrend(self, data):
        """业务case：商品详情#价格走势"""
        priceTrend_response = self.priceTrend_api(**data['json'])
        res = priceTrend_response.json()
        return res

    @allure.step("step:case_saleuserreward")
    def case_saleuserreward(self, data):
        """业务case：作品打赏用户列表"""
        saleuserreward_response = self.saleuserreward_api(**data['json'])
        res = saleuserreward_response.json()
        return res

    @allure.step("step:case_rewardPollen")
    def case_rewardPollen(self, data):
        """业务case：给作品打赏花粉"""
        rewardPollen_response = self.rewardPollen_api(**data['json'])
        res = rewardPollen_response.json()
        return res

    @allure.step("step:case_imageUpload")
    def case_imageUpload(self, **kwargs):
        """业务case：获取图片地址URL"""
        imageUpload_response = self.imageUpload_api(**kwargs)
        return imageUpload_response

    @allure.step("step:case_productSeries")
    def case_productSeries(self, token):
        """业务case：获取用户创建的系列列表"""
        productSeries_response = self.productSeries_list_api(token)
        res = productSeries_response.json()
        return res

    @allure.step("step:case_create")
    def case_create(self, data):
        """业务case：铸造NFT"""
        create_response = self.create_api(**data['json'])
        res = create_response.json()
        return res

    @allure.step("step:creator_list")
    def case_creator_list(self, data):
        """业务case：创作者页面"""
        creator_list_response = self.creator_list_api(**data['json'])
        res = creator_list_response.json()
        return res

    @allure.step("step:case_info")
    def case_info(self, data):
        """业务case：查看艺术家/机构"""
        detail_response = self.info_api(**data["json"])
        res = detail_response.json()
        return res

    @allure.step("step:case_ownerList")
    def case_ownerList(self, data):
        """业务case：个人/他人空间#持有的作品"""
        detail_response = self.ownerList_api(**data["json"])
        res = detail_response.json()
        return res

    @allure.step("step:case_productSeries_createList")
    def case_productSeries_createList(self, data):
        """业务case：个人/他人空间#创建的系列列表"""
        productSeries_createList_response = self.productSeries_createList_api(**data["json"])
        res = productSeries_createList_response.json()
        return res

    @allure.step("step:case_product_list")
    def case_product_list(self, data):
        """业务case：个人/他人空间#创建的作品"""
        product_list_response = self.product_list_api(**data["json"])
        res = product_list_response.json()
        return res

    @allure.step("step:case_attentionList")
    def case_attentionList(self, data):
        """业务case：个人/他人空间#关注的作品"""
        attentionList_response = self.attentionList_api(**data["json"])
        res = attentionList_response.json()
        return res

    @allure.step("step:case_createList")
    def case_createList(self, data):
        """业务case：个人NFT铸造#列表"""
        createList_response = self.createList_api(data)
        res = createList_response.json()
        return res

    @allure.step("step:case_productSale_list")
    def case_productSale_list(self, data):
        """业务case：个人挂售单"""
        productSale_list_response = self.productSale_list_api(**data['json'])
        res = productSale_list_response.json()
        return res

    @allure.step("step:case_order")
    def case_order(self, data):
        """业务case：个人挂售单"""
        order_response = self.order_api(**data['json'])
        res = order_response.json()
        return res

    @allure.step("step:case_settlement_list")
    def case_settlement_list(self, data):
        """业务case：个人结算数量"""
        settlement_list_response = self.settlement_list_api(**data['json'])
        res = settlement_list_response.json()
        return res

    @allure.step("step:case_rewardPollenList")
    def case_rewardPollenList(self, data):
        """业务case：个人结算数量"""
        rewardPollenList_response = self.rewardPollenList_api(**data['json'])
        res = rewardPollenList_response.json()
        return res

    @allure.step("step:case_productSale_recommend")
    def case_productSale_recommend(self, data):
        """业务case：详情页相关推荐"""
        productSale_recommend_response = self.productSale_recommend_api(data)
        res = productSale_recommend_response.json()
        return res

    @allure.step("step:case_canSaleList")
    def case_canSaleList(self, data):
        """业务case：NFT挂售#选择可列挂售商品列表"""
        canSaleList_response = self.canSaleList_api(data)
        res = canSaleList_response.json()
        return res

    @allure.step("step:case_price_calculate")
    def case_price_calculate(self, data):
        """业务case：NFT挂售#价格变动计算"""
        price_calculate_response = self.price_calculate_api(**data["json"])
        res = price_calculate_response.json()
        return res

    @allure.step("step:case_up")
    def case_up(self, data):
        """业务case：NFT挂售#上架"""
        up_response = self.up_api(**data["json"])
        res = up_response.json()
        return res

    @allure.step("step:case_down")
    def case_down(self, data):
        """业务case：NFT挂售#下架"""
        down_response = self.down_api(**data["json"])
        res = down_response.json()
        return res

